<template>
    <el-select clearable filter :loading="loading" v-model="teacher" placeholder="请选择老师">
        <el-option v-for="item in list" :key="`teacher-${item.id}`" :value="item.id" :label="item.name"></el-option>
    </el-select>
</template>
<script>
import { get } from '@/assets/js/http';

export default{
    props:{
        value:Number
    },
    data(){
        return{
            loading:false,
            teacher:null,
            list:[]
        }
    },
    watch:{
        teacher(){
            this.$emit('input',this.teacher)
        }
    },
    created(){
        this.getList()
    },  
    methods:{
        async getList(){
            this.loading = true
            await get({
                url:'/admin/project.Teacher/index',
                params:{
                    page:1,
                    limit:99999
                }
            }).then(res=>{
                console.log(res);
                this.list = res.list
            })
            this.loading = false
        }
    }
}
</script>